package com.learning.railwayreservation.biz;

import java.util.List;
import com.learning.railwayreservation.dao.CheckTicketsAvailibiltyDao;
import com.learning.railwayreservation.vo.CheckTicketsAvailibiltyInputVO;
import com.learning.railwayreservation.vo.AvailabilityDetailsVo;
import com.learning.railwayreservation.vo.SeatVO;

public class CheckTicketsAvailibilty {
	public static void main(String args[]) {
		CheckTicketsAvailibilty checkTicketsAvailibilty = new CheckTicketsAvailibilty();
		System.out.println("\nhere is the result\n");
		System.out.println("\nList of Tickets\n");
		CheckTicketsAvailibiltyInputVO availibility2VO = new CheckTicketsAvailibiltyInputVO();
		//availibility2VO.setRouteId(2);
		availibility2VO.setTrainId(1);
		availibility2VO.setStartDate("2003-05-03");
		availibility2VO.setBoggieType("AC");
		availibility2VO.setRequiredSeats(1);
		checkTicketsAvailibilty.doTicketEnquiry(availibility2VO);

	}

	public AvailabilityDetailsVo doTicketEnquiry(
			CheckTicketsAvailibiltyInputVO checkTicketsAvailibiltyInputVO) {

		CheckTicketsAvailibiltyDao dao = new CheckTicketsAvailibiltyDao();
		AvailabilityDetailsVo availabilityDetailsVo = dao
				.getSeatAvailDetails(checkTicketsAvailibiltyInputVO);

		System.out
				.print("\nTrain Name:" + availabilityDetailsVo.getTrainName());
		System.out
				.print("\nTrain Number:" + availabilityDetailsVo.getTrainId());

		for (SeatVO seatVo : availabilityDetailsVo.getSeatList()) {
			System.out.print("     Boggie id:" + seatVo.getBoggieId());
			System.out.print("    Row id:" + seatVo.getRowId());
			System.out.print("     Seat id:" + seatVo.getSeatId());
			System.out.print("  unique Seat id:" + seatVo.getUniqueSeatId());
			System.out.print("\n");

		}

		return availabilityDetailsVo;
	}
}
